package com.yxw.yxnet_cd_center.gateway.common;

import com.yxw.yxnet_cd_center.common.constant.CommonConstant;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author: xxx
 * @Date: 2019/8/17 17:14
 */
@Configuration
public class UrlWhileList implements InitializingBean {
    //不需要校验token的集合
    private final static List<String> URL_LIST = new ArrayList<String>();

    //校验token,不需要校验过期时间集合
    private final static List<String> TOKEN_EXPIRE_LIST = new ArrayList<String>();

    @Value("${spring.profiles.active}")
    private String env;

    @Override
    public void afterPropertiesSet() {
        if (!CommonConstant.PROFILE_ENV_PROD.equals(env)) {
            URL_LIST.add("/swagger-ui.html");
            URL_LIST.add("/doc.html");
        }
        //获取验证码
        URL_LIST.add("/logon/v1/validateImage");
        //获取token接口
        URL_LIST.add("/logon/v1/getToken");
        //账号密码登录
        URL_LIST.add("/logon/v1/login");
        //短信
        URL_LIST.add("/logon/v1/send");
        //电话登录  /clientTest
        URL_LIST.add("/logon/v1/phone");
        //登出
        URL_LIST.add("/logon/v1/logout");
        //对外Api
        URL_LIST.add("/custom-service/css/openapi/");
        URL_LIST.add("/custom-service/customerprocess/CustomQueryTechnicalSupportFlockUsers");
        //live-vod-boot
        URL_LIST.add("/live-vod-boot/api/live/yxlive/clientTest");
        URL_LIST.add("/live-vod-boot/api/sys/v1/login");
        URL_LIST.add("/live-vod-boot/api/sys/v1/logout");
        URL_LIST.add("/live-vod-boot/api/sys/v1/refreshToken");
        URL_LIST.add("/live-vod-boot/api/sys/auth/login");
        URL_LIST.add("/live-vod-boot/api/sys/v1/phone");
        URL_LIST.add("/live-vod-boot/api/sys/v1/send");
        URL_LIST.add("/live-vod-boot/api/sys/v1/updatePwdByPhone");
        URL_LIST.add("/live-vod-boot/api/sys/v1/verifyPwdSms");
        /**
         * 校验token,不需要校验过期时间集合
         */
        TOKEN_EXPIRE_LIST.add("/logon/v1/refreshToken");

    }

    public static List<String> getUrlList() {
        return URL_LIST;
    }

    public static List<String> getTokenExpireList() {
        return TOKEN_EXPIRE_LIST;
    }
}

